home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIUnicharStreamLoader.idl < prev    next >
Text File  |  2006-05-08  |  4KB  |  111 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 2002
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *    Darin Fisher <darin@netscape.com>  (original author)
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  27.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. #include "nsISupports.idl"
  40.  
  41. interface nsIUnicharInputStream;
  42. interface nsIUnicharStreamLoader;
  43. interface nsIChannel;
  44.  
  45. [scriptable, uuid(e06e8b08-8cdd-4503-a0a0-6f3b943602af)]
  46. interface nsIUnicharStreamLoaderObserver : nsISupports
  47. {
  48.   /**
  49.    * Called when the first full segment of data if available.
  50.    *
  51.    * @param aLoader the unichar stream loader
  52.    * @param aContext the aContext parameter passed to the loader's init method
  53.    * @param aFirstSegment the raw bytes of the first full data segment
  54.    * @param aLength the length of aFirstSegment
  55.    *
  56.    * @return charset corresponding to this stream
  57.    */
  58.   ACString onDetermineCharset(in nsIUnicharStreamLoader aLoader,
  59.                               in nsISupports aContext,
  60.                               [size_is(aLength)] in string aFirstSegment,
  61.                               in unsigned long aLength);
  62.  
  63.   /**
  64.    * Called when the entire stream has been loaded.
  65.    *
  66.    * @param aLoader the unichar stream loader
  67.    * @param aContext the aContext parameter passed to the loader's init method
  68.    * @param aStatus the status of the underlying channel
  69.    * @param aUnicharData the unichar input stream containing the data.  This
  70.    *        can be null in some failure conditions.
  71.    */
  72.   void onStreamComplete(in nsIUnicharStreamLoader aLoader,
  73.                         in nsISupports aContext,
  74.                         in nsresult aStatus,
  75.                         in nsIUnicharInputStream aUnicharData);
  76. };
  77.  
  78. [scriptable, uuid(8a3eca16-167e-443d-9485-7e84ed822e95)]
  79. interface nsIUnicharStreamLoader : nsISupports
  80. {
  81.   const unsigned long DEFAULT_SEGMENT_SIZE = 4096;
  82.  
  83.   /**
  84.    * Initializes the unichar stream loader
  85.    *
  86.    * @param aChannel the channel to read data from.  This should _not_ be
  87.    *        opened; the loader will open the channel itself.
  88.    * @param aObserver the observer to notify when a charset is needed and when
  89.    *        the load is complete
  90.    * @param aContext an opaque context pointer
  91.    * @param aSegmentSize the size of the segments to use for the data, in bytes
  92.    */
  93.   
  94.   void init(in nsIChannel aChannel,
  95.             in nsIUnicharStreamLoaderObserver aObserver,
  96.             in nsISupports aContext,
  97.             in unsigned long aSegmentSize);
  98.  
  99.   /**
  100.    * The channel attribute is only valid inside the onDetermineCharset
  101.    * and onStreamComplete callbacks.  Otherwise it will be null.
  102.    */
  103.   readonly attribute nsIChannel channel;
  104.  
  105.   /**
  106.    * The charset that onDetermineCharset returned, if that's been
  107.    * called.
  108.    */
  109.   readonly attribute ACString charset;
  110. };
  111.